{% extends "base.html" %}

{% comment %}
    This template displays a list of posts
{% endcomment %}

{% block content %}
    <h2>Blog posts</h2>
    <ul class="post-list">
        {% for post in posts_list %}
            {% if post.is_published or is_logged_in %}
                <li>
                    <h3>
                        <a href="{{ root_url }}/posts/{{ post.id }}">
                            {{ post.title }}
                        </a>
                    </h3>
                    {% include "snippets/byline.html" %}
                    <p>{{ post.body|truncatewords:250 }}</p>
                    {% include "snippets/tags.html" %}
                </li>
            {% endif %}
        {% empty %}
            <li>No posts available</li>
        {% endfor %}
    </ul>

{% endblock %}
